package com.ce.tag;

import java.util.LinkedHashMap;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.tagext.DynamicAttributes;

public class HtmlBaseTag extends BodyTagSupport implements DynamicAttributes{
	private static final long serialVersionUID = 1L;

	protected LinkedHashMap<String,String> attr = new LinkedHashMap<String, String>();

	protected String getHtmlAttrString(){
		StringBuffer html = new StringBuffer();
		for(String k:attr.keySet()){
			html.append(" ").append(k);
			if(attr.get(k)!=null){
				html.append("=\"").append(attr.get(k)).append("\"");
			}
		}
		return html.toString();
	}
	public void setDynamicAttribute(String uri,String localeName,Object value) throws JspException {
		attr.put(localeName, ""+value);
	}

}
